package com.bootdo.common.listenner;

import com.bootdo.common.scheduler.MyScheduler;
import com.bootdo.common.service.JobService;
import com.bootdo.common.task.MaterrialJob;
import com.bootdo.provider.service.GoodsInfoService;
import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * Created by clq on 2018/5/7
 */
@Component
@Order(value = 2)
public class ScheduleTaskInitListenner implements CommandLineRunner {
    @Autowired
    JobService scheduleJobService;
    @Autowired
    private GoodsInfoService goodsInfoService;

    @Override
    public void run(String... strings) throws Exception {
//        JobDetail job = JobBuilder.newJob(MaterrialJob.class)
//                .withIdentity("dummyJobName", "group1").build();
//        Trigger trigger = TriggerBuilder
//                .newTrigger()
//                .withIdentity("dummyTriggerName", "group1")
//                .withSchedule(
//                        SimpleScheduleBuilder.simpleSchedule()
//                                .withIntervalInSeconds(5).repeatForever())
//                .build();
//
//        // schedule it
//        Scheduler scheduler = new StdSchedulerFactory().getScheduler();
//        scheduler.start();
//        scheduler.scheduleJob(job, trigger);






    }
}
